package com.example.springbootquartz.job;
import lombok.extern.slf4j.Slf4j;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import java.time.LocalDateTime;

/**
 * Created by IntelliJ IDEA2022.3.2
 * @Author: Tenghw
 * @Date: 2023/08/05  11:00
 * @Description:
 */

@Slf4j
public class QuartzJob2 implements Job {
    private void before(){
        //log.warn("QuartzJob2任务开始执行前：{}", LocalDateTime.now());
    }
    @Override
    //@Async("schedulerThreadPool")
    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
        before();
        log.info("QuartzJob2任务开始执行：{}，线程名：{}", LocalDateTime.now(),Thread.currentThread().getName());
        // 这里可以做些业务，比如定时清算库存、发短信等等
        after();
    }

    private void after(){
        //log.warn("QuartzJob2任务开始执行后：{}", LocalDateTime.now());
    }
}
